<template>
	<view>
		 <view v-if="isInit" v-cloak>
			 <noRecord v-if="menuInfo.list == []" :info="info"  v-cloak></noRecord>
			 <menuBox v-else :menuInfo="menuInfo"  @loadMore="addPage"></menuBox>
		 </view>
	</view>
</template>

<script>
import menuBox from '@/wxcomponents/commonLayout/menuList.vue';
import noRecord from '@/wxcomponents/commonLayout/noRecord.vue';
import { getDictName, dectList } from '@/libs/common.js';
export default {
	data() {
		return {
			// leaveStatusStr: 1, //tab切换状态 待审批为1 已审批为2,3
			// pendingApproval:'', //待审批
			// approved: '', //已审批
			isInit:false,
			info:"没有报修记录!",
			studentName:"",
			menuInfo: {
				base: {
					menuProp: ['applyDate',  'status'],
					tit: ['日期',  '状态'],
					class: 'typeTwo',
					loadMore: true
				},
				list: []
			},
			pageParams: {
				pageNum: 1,
				pageSize: 20
			}
		};
	},
	onLoad() {
		this.getList();
	},
	methods: {
		async getList() {
			let resp = await this.$http.post({
				url: '/oa/wechat/repairsApply/page',
				data: this.pageParams
			});
			let dictList = await dectList('dict_oa_repairs');
			if (resp.result.rows.length < this.pageParams.pageSize || resp.result.rows.length == 0) {
				this.menuInfo.base.loadMore = false;
			}
			if(resp.code ==0){
				resp.result.rows.forEach(async item=>{
					item.detailType = 'detail'
					this.menuInfo.list.push({
						url:`fixedDetail?data=${JSON.stringify(item)}`,
						applyDate:item.applyDate.substring(0, 10),
						// amount:item.reimburseAmount,
						status:await getDictName(dictList, item.applyStatus),
						data: item,
						class: item.applyStatus == 1 ? 'dsp' : item.applyStatus == 2 ? 'ytg' : 'wtg'
					})
				})
				this.isInit = true
			}
		},
		// 加载下一页
		addPage() {
			this.pageParams.pageNum++
			this.getList()
		}
		
	},
	components: { menuBox ,noRecord}
};
</script>

<style lang="scss" scoped>
[v-cloak]{
		 display: none !important;
}
.tab {
	width: 650upx;
	height: 72upx;
	background: rgba(218, 221, 229, 1);
	border-radius: 8upx;
	margin: 20upx auto;
	padding: 4upx 5upx;

	text {
		width: 320upx;
		height: 64upx;
		display: inline-block;
		text-align: center;
		color: #999999;
	}

	.active {
		background: rgba(255, 255, 255, 1);
		box-shadow: 0px 2upx 10upx 0px rgba(0, 0, 0, 0.1);
		border-radius: 8upx;
		font-size: 28upx;
		font-family: Source Han Sans CN;
		font-weight: 400;
		color: rgba(51, 51, 51, 1);
		text-align: center;
		line-height: 64upx;
	}
}
.search{
	width: 650upx;
	margin: 20upx auto;
	border: 1upx solid #ddd;
	height:60upx;
	border-radius: 30upx;
	position: relative;
	image{
		width: 50upx;
		height: 50upx;
		position: absolute;
		top: 5upx;
		left: 10upx;
	}
	input{
		width: 590upx;
		height: 50upx;
		position: absolute;
		left: 60upx;
		top: 5upx;
		color:#999;
		font-size: 28upx;
	}
	.input-placeholder{
		color:#999;
		font-size: 28upx;
	}
}
</style>
